#pragma once

#include <QDialog>
#include <QSqlDatabase>

#include <QCompleter>
#include <QLineEdit>
#include <QListWidget>
#include <QTimer>

class QFileSearchDialog : public QDialog
{
    Q_OBJECT
public:
    explicit QFileSearchDialog(QWidget *parent = nullptr, QString databasePath = QString());
    ~QFileSearchDialog() override;

    QString selectedFile() const;

private:
    QSqlDatabase m_database;

    QLineEdit *m_searchLineEdit = nullptr;
    QTimer *m_searchTimer = nullptr;
    QListWidget *m_resultsListWidget = nullptr;

    void initializeUI();
    void searchFiles(const QString &query);
};